package com.exposit.books.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/admin")
public class AdminStatisticsOfShopController {

	@RequestMapping(value = "/afavorablestatistics", method = RequestMethod.GET)
	public String afavorablestatistics(Model model) {
		
		model.addAttribute("more", "");

		return "administrator/statistics/afavorablestatistics";
	}
	
	@RequestMapping(value="/afavorablestatistics", method=RequestMethod.POST)
	public ModelAndView statistics(
			@RequestParam(value = "count", required = true) String count,
			HttpServletRequest request,
			HttpSession session) {
		
		ModelAndView mav=new ModelAndView();
		if(count.equals("")){
			mav.addObject("more", "");
		}
		else{
		mav.addObject("more", "here will be top "+count+" genres");
		}
		mav.setViewName("administrator/statistics/afavorablestatistics");
		return mav;
		
	}
	
}
